package com.heima.crm.controller;

import com.heima.crm.common.result.Result;
import com.heima.crm.service.StatisticsService;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("/index")
@RequiredArgsConstructor
public class IndexController {
    private final StatisticsService statisticsService;
    @GetMapping("/basic")
    public Result index(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,
                        @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {

        return statisticsService.getIndexData(begin,end);
    }
}
